package h0727;

import java.util.*;

public class TreasureHunt {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt();
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        scanner.close();

        System.out.println(maxGold(m, n, k));
    }

    public static int maxGold(int m, int n, int k) {
        boolean[][] visited = new boolean[m][n];
        return dfs(0, 0, m, n, k, visited);
    }

    private static int dfs(int x, int y, int m, int n, int k, boolean[][] visited) {
        if (x < 0 || x >= m || y < 0 || y >= n || visited[x][y] || digitSum(x) + digitSum(y) > k) {
            return 0;
        }

        visited[x][y] = true;
        int gold = 1; // 每个方格有一克黄金

        // 四个方向移动
        gold += dfs(x + 1, y, m, n, k, visited);
        gold += dfs(x - 1, y, m, n, k, visited);
        gold += dfs(x, y + 1, m, n, k, visited);
        gold += dfs(x, y - 1, m, n, k, visited);

        return gold;
    }

    private static int digitSum(int num) {
        int sum = 0;
        while (num > 0) {
            sum += num % 10;
            num /= 10;
        }
        return sum;
    }
}
